﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

    <div class="dung-round">
    <p>
        <input id="statuslist" type="hidden" value="all"/>
        
        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <label><b>Từ ngày</b></label>
        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <input id="searchdatefrom" class="inputDate dung-textbox" value="01/01/2000" type="text" readonly="readonly" maxlength="30" />

        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <label><b>đến ngày</b></label>
        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <input id="searchdateto" class="inputDate dung-textbox" value="31/12/2100" type="text" readonly="readonly" maxlength="30" />

        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <input id="btnSearch" class="dung-button" value="Tìm kiếm" type="button" onclick="search(1)" />

        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <input id="btnViewAll" class="dung-button" value="Xem tất cả" type="button" onclick="viewall(1)" />

        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
        <input id="Button1" class="dung-button" value="Khảo sát hiện thời" type="button" onclick="surveycurrent(1)" />

    </p>
    </div>
    <script type="text/javascript">

        function surveycurrent(pageindex) {
            $("#statuslist").val("search");
            $.get("/Survey/List/" + pageindex + "?pDateFrom=" + $("#searchdatefrom").val() + "&pDateTo=" + $("#searchdateto").val() + "&pIsTop=true",
                function (data) {
                    $('#surveylist').fadeOut();
                    $('#surveylist').html(data);
                    $('#surveylist').fadeIn();
                }
            );
            }

        function search(pageindex) { 
            $("#statuslist").val("search");
            $.get("/Survey/List/" + pageindex + "?pDateFrom=" + $("#searchdatefrom").val() + "&pDateTo=" + $("#searchdateto").val() + "" , 
                function (data) {
                    $('#surveylist').fadeOut();
                    $('#surveylist').html(data);
                    $('#surveylist').fadeIn();
                }
            );     
        }

        function viewall(pageindex)
        {
            $("#statuslist").val("all");
            $("#searchdatefrom").val("1/1/1973");
            $("#searchdateto").val("31/12/2100");
            $.get("/Survey/List/" + pageindex + "?pDateFrom=" + $("#searchdatefrom").val() + "&pDateTo=" + $("#searchdateto").val() + "" , 
                function (data) {
                    $('#surveylist').fadeOut();
                    $('#surveylist').html(data);
                    $('#surveylist').fadeIn();
                }
            );     
        }

    </script>
